﻿package view
{
    import cmd.*;
    import com.core.*;
    import com.core.display.*;
    import com.greensock.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import control.*;
    import flash.display.*;
    import flash.events.*;
    import flash.filters.*;
    import flash.geom.*;
    import flash.text.*;
    import flash.utils.*;
    import manager.*;
    import morn.core.components.*;
    import plugin.NewSkill.handler.*;
    import plugin.taskdialog.consts.*;
    import pluginfw.nio.*;
    import view.message.*;
    import view.uilt.*;

    public class GuideView extends Sprite
    {
        private var _field:TextField;
        private var _tips:MyLabel;
        private var _bgSprite:Sprite;
        private var _zySprite:Sprite;
        private var lv:int;
        public var gid:int;
        private var _container:Sprite;
        private var _guideMc:Clip;
        private var isload:Boolean = false;
        private var _dir:int = 0;
        private var _noshow:int = 0;
        private var _item:Object;
        private var _tt:Number = 1;
        private var format2:TextFormat;
        private var guideFlag:Boolean;
        private var _byteLoader:Loader;
        private var _tweenLite1:TweenMax;
        private var _tweenLite2:TweenMax;
        private var timeoutID1:uint;
        private var p:Point;
        private var p1:Point;
        private var p2:Point;
        private var p3:Point;
        private var _isshow:Boolean = true;
        private var p5:Point;
        private var newguideObj:Object;
        private var oldLevel:int = 0;
        private var fTaskArr:Array;
        private var timeoutID:uint;
        private var timeoutID3:uint;
        private var guideImg:Image;
        private var _cfgGuide:Object;
        private var _cfgTypeGuide:Object;
        private var _cfgLvGuide:Array;
        private var timeline:TweenMax;
        private var zyImg:Image;
        private var isTxt:Boolean;
        private var square:Shape;
        private static var instance:GuideView;

        public function GuideView()
        {
            this.format2 = new TextFormat("宋体", 12, null, true);
            this.p = new Point(0, 0);
            this.p1 = new Point(0, 0);
            this.p2 = new Point(0, 0);
            this.p3 = new Point(0, 0);
            this.p5 = new Point();
            this.fTaskArr = [];
            this._cfgLvGuide = [];
            return;
        }// end function

        public function init() : void
        {
            this._bgSprite = new Sprite();
            var _loc_1:* = new Image();
            _loc_1.url = "png.common.guidebg";
            this._bgSprite.addChild(_loc_1);
            this._field = new TextField();
            this._field.width = 140;
            this._field.height = 20;
            this._field.defaultTextFormat = this.format2;
            this._field.textColor = MColor.New16;
            this._field.x = 17;
            this._field.y = 17;
            this._field.text = "开始游戏";
            this._field.autoSize = TextFieldAutoSize.CENTER;
            this._bgSprite.addChild(this._field);
            this._zySprite = new Sprite();
            this.zyImg = new Image();
            this.zyImg.url = "png.common.guidezy";
            this.zyImg.sizeGrid = "40,40,50,20";
            this.zyImg.alpha = 0.8;
            this._zySprite.addChild(this.zyImg);
            this.zyImg.mouseEnabled = false;
            this.zyImg.mouseChildren = false;
            this._tips = new MyLabel();
            this._tips.leading = 3;
            this._tips.wordWrap = true;
            this._zySprite.addChild(this._tips);
            this._zySprite.mouseEnabled = false;
            this._container = new Sprite();
            addChild(this._container);
            this.guideImg = new Image();
            this.guideImg.url = "png.common.guide";
            this.guideImg.y = -27;
            this._container.addChild(this.guideImg);
            this.isload = true;
            if (this._cfgGuide == null)
            {
                this._cfgGuide = ConfigDictionary.data.newguide;
                this._cfgTypeGuide = ConfigDictionary.data.typenewguide;
            }
            var _loc_2:* = Control.create(GuideControl, this);
            ModelProxy.addObserver("guide", _loc_2);
            GlobalLayer.instance.getLayer("guideCon").addChild(this);
            this._tips.addEventListener(MouseEvent.MOUSE_DOWN, this.doStop);
            this.visible = false;
            this.mouseEnabled = false;
            return;
        }// end function

        protected function doStop(event:MouseEvent) : void
        {
            event.stopPropagation();
            return;
        }// end function

        private function linkHandler(event:TextEvent) : void
        {
            var nobj:Object;
            var e:* = event;
            var arr:* = e.text.split("&");
            switch(int(arr[0]))
            {
                case 1:
                {
                    nobj = ConfigDictionary.data.sysnpc[80];
                    if (this._isshow)
                    {
                        Alert2.show("即将瞬间传送到回收NPC处，是否确认传送？", "", ["确定", "取消"], function (param1:int, param2:Object) : void
            {
                if (param1 == 0)
                {
                    if (ItemUilt.checkMapIsFly())
                    {
                        PluginManager.instance.sendToServer("taskdialog", CMDTaskdialog.Fly, {x:nobj.x, y:nobj.y, tostageid:nobj.stageid});
                        ModelProxy.change("data", "taskfindpath", nobj.npcid);
                    }
                }
                else if (param1 == 100)
                {
                    if (ItemUilt.checkMapIsFly())
                    {
                        PluginManager.instance.sendToServer("taskdialog", CMDTaskdialog.Fly, {x:nobj.x, y:nobj.y, tostageid:nobj.stageid});
                        ModelProxy.change("data", "taskfindpath", nobj.npcid);
                    }
                    _isshow = false;
                }
                else if (param1 == 101)
                {
                    _isshow = false;
                }
                return;
            }// end function
            , null, false, true, true);
                    }
                    else if (ItemUilt.checkMapIsFly())
                    {
                        PluginManager.instance.sendToServer("taskdialog", CMDTaskdialog.Fly, {x:nobj.x, y:nobj.y, tostageid:nobj.stageid});
                        ModelProxy.change("data", "taskfindpath", nobj.npcid);
                    }
                    this.hide();
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function loadArrow(event:Event) : void
        {
            this._container = new Sprite();
            addChild(this._container);
            this.isload = true;
            return;
        }// end function

        public function show(param1:String, param2:Point, param3:int) : void
        {
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            if (param2.x == 0 && param2.y == 0)
            {
                return;
            }
            this._field.text = param1;
            var _loc_4:int = 0;
            if (this._tweenLite1)
            {
                this._tweenLite1.kill();
            }
            if (this._tweenLite2)
            {
                this._tweenLite2.kill();
            }
            if (this.square && this.square.parent)
            {
                this.square.graphics.clear();
                this.square.filters = [];
                this.square.parent.removeChild(this.square);
            }
            if (this.timeline)
            {
                this.timeline.kill();
            }
            this._bgSprite.x = 0;
            this._bgSprite.y = 0;
            this._container.x = 0;
            this._container.y = 0;
            this._zySprite.x = 0;
            this._zySprite.y = 0;
            this.guideFlash();
            if (param3 == 2)
            {
                _loc_5 = this.newguideObj.w;
                _loc_6 = this.newguideObj.h;
                if (_loc_5 == 0 || _loc_6 == 0)
                {
                    this.zyImg.setSize(220, 80);
                }
                else
                {
                    this.zyImg.setSize(_loc_5, _loc_6);
                }
                if (this._dir == 1)
                {
                    this.zyImg.rotation = 0;
                    this._zySprite.x = -(this.zyImg.width - 14);
                    this._zySprite.y = 3;
                    this._tips.x = 15;
                    this._tips.y = 35;
                }
                else
                {
                    this.zyImg.rotation = 180;
                    this._zySprite.x = -14 + this.zyImg.width;
                    this._zySprite.y = 3;
                    this._tips.x = 8 - this.zyImg.width;
                    this._tips.y = 8 - this.zyImg.height;
                }
                this._tips.text = param1;
                this._tips.width = this.zyImg.width - 20;
                this._zySprite.visible = true;
                addChild(this._zySprite);
                if (this.timeoutID3)
                {
                    clearInterval(this.timeoutID3);
                    this.timeoutID3 = 0;
                }
                this.timeoutID3 = setInterval(this.onEnterFrame, 200);
                this._container.visible = false;
                this._bgSprite.visible = false;
                this._tips.removeEventListener(TextEvent.LINK, this.linkHandler);
                this._tips.addEventListener(TextEvent.LINK, this.linkHandler);
                return;
            }
            if (this._dir == 1)
            {
                _loc_4 = 90;
                this._container.rotation = _loc_4;
                this._bgSprite.x = -82;
                this._bgSprite.y = 25;
            }
            else if (this._dir == 4)
            {
                _loc_4 = -180;
                this._container.rotation = _loc_4;
                this._bgSprite.x = -161 - 54;
                this._bgSprite.y = -26;
                this._container.x = -27;
            }
            else if (this._dir == 2)
            {
                _loc_4 = -90;
                this._container.rotation = _loc_4;
                this._bgSprite.x = -82;
                this._bgSprite.y = -106;
                this._container.y = -27;
            }
            else if (this._dir == 3)
            {
                this._container.rotation = _loc_4;
                this._bgSprite.x = 24;
                this._bgSprite.y = -26;
            }
            if (this._noshow == 0)
            {
                addChild(this._bgSprite);
                addChild(this._container);
                this._zySprite.visible = false;
                this._container.visible = true;
                this._bgSprite.visible = true;
            }
            else
            {
                this._zySprite.visible = false;
                this._container.visible = false;
                this._bgSprite.visible = false;
                if (this._bgSprite.parent)
                {
                    this._bgSprite.parent.removeChild(this._bgSprite);
                }
                if (this._zySprite.parent)
                {
                    this._zySprite.parent.removeChild(this._zySprite);
                }
                if (this._container.parent)
                {
                    this._container.parent.removeChild(this._container);
                }
            }
            this.guideFlag = true;
            this.playGuide1();
            if (this.timeoutID3)
            {
                clearInterval(this.timeoutID3);
                this.timeoutID3 = 0;
            }
            this.timeoutID3 = setInterval(this.onEnterFrame, 200);
            return;
        }// end function

        private function guideFlash() : void
        {
            var _loc_1:String = null;
            var _loc_2:TextField = null;
            var _loc_3:String = null;
            var _loc_4:Label = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            if (this._item is Label || this._item is LinkButton)
            {
                this.isTxt = true;
                this.square = new Shape();
                this.square.graphics.lineStyle(1, 16766720);
                this.square.filters = [new GlowFilter(16580393, 0.8, 6, 6, 2, BitmapFilterQuality.LOW)];
                _loc_1 = "";
                if (this._item is Label)
                {
                    _loc_1 = this._item.text;
                }
                else
                {
                    _loc_1 = this._item.label;
                }
                _loc_2 = new TextField();
                _loc_2.htmlText = _loc_1;
                _loc_3 = _loc_2.text;
                _loc_4 = new Label();
                _loc_5 = _loc_3.indexOf(" ");
                if (_loc_5 > 0)
                {
                    _loc_4.text = _loc_3.substring(0, _loc_5);
                }
                else
                {
                    _loc_4.text = _loc_3;
                }
                _loc_4.autoSize = "left";
                _loc_6 = _loc_4.width;
                this.square.graphics.drawRect(this._item.x, this._item.y, _loc_6, 16);
                this.square.graphics.endFill();
                this._item.parent.addChild(this.square);
            }
            else
            {
                this.isTxt = false;
            }
            return;
        }// end function

        private function playGuide1() : void
        {
            if (this.guideFlag)
            {
                if (this._dir == 1 || this._dir == 2)
                {
                    if (this._noshow == 0)
                    {
                        this._tweenLite1 = TweenMax.to(this._bgSprite, this._tt, {y:this._bgSprite.y + 34 + int(this.newguideObj.y), repeat:10000, yoyo:true});
                        this._tweenLite2 = TweenMax.to(this._container, this._tt, {y:this._container.y + 34 + int(this.newguideObj.y), repeat:10000, yoyo:true});
                    }
                    if (!this.isTxt && this._item)
                    {
                        this.timeline = TweenMax.to(this._item, this._tt, {glowFilter:{color:16763904, alpha:1, blurX:15, blurY:15, strength:2}, repeat:10000, yoyo:true});
                    }
                }
                else
                {
                    if (this._noshow == 0)
                    {
                        this._tweenLite1 = TweenMax.to(this._bgSprite, this._tt, {x:this._bgSprite.x + 34 + int(this.newguideObj.x), repeat:10000, yoyo:true});
                        this._tweenLite2 = TweenMax.to(this._container, this._tt, {x:this._container.x + 34 + int(this.newguideObj.x), repeat:10000, yoyo:true});
                    }
                    if (!this.isTxt && this._item)
                    {
                        this.timeline = TweenMax.to(this._item, this._tt, {glowFilter:{color:16763904, alpha:1, blurX:15, blurY:15, strength:2}, repeat:10000, yoyo:true});
                    }
                }
            }
            return;
        }// end function

        private function onEnterFrame() : void
        {
            this.p5 = this.getPoint();
            this.x = this.p5.x;
            this.y = this.p5.y;
            if (this.x != 0 && this.y != 0)
            {
                this.visible = true;
                instance.visible = true;
            }
            return;
        }// end function

        public function hide(param1:Boolean = true) : void
        {
            if (this.timeoutID1)
            {
                clearTimeout(this.timeoutID1);
                this.timeoutID1 = 0;
            }
            instance.visible = false;
            this.visible = false;
            this.guideFlag = false;
            if (this.timeoutID)
            {
                clearTimeout(this.timeoutID);
                this.timeoutID = 0;
            }
            if (this.timeoutID3)
            {
                clearInterval(this.timeoutID3);
                this.timeoutID3 = 0;
            }
            if (this._tweenLite1)
            {
                this._tweenLite1.kill();
            }
            if (this._tweenLite2)
            {
                this._tweenLite2.kill();
            }
            if (this.timeline)
            {
                this.timeline.kill();
            }
            if (this._item && !this._item.disabled)
            {
                this._item.filters = [];
                this._item = null;
            }
            if (this.square && this.square.parent)
            {
                this.square.graphics.clear();
                this.square.filters = [];
                this.square.parent.removeChild(this.square);
            }
            if (this._guideMc && this._guideMc.parent)
            {
                this._guideMc.parent.removeChild(this._guideMc);
                this._guideMc.dispose();
                this._guideMc = null;
            }
            if (this._bgSprite.parent)
            {
                this._bgSprite.parent.removeChild(this._bgSprite);
            }
            if (this._zySprite.parent)
            {
                this._zySprite.parent.removeChild(this._zySprite);
            }
            if (this._container.parent)
            {
                this._container.parent.removeChild(this._container);
            }
            if (param1 && this.gid > 0)
            {
                if (this._cfgTypeGuide[5][this.gid])
                {
                    this.doGuide(this._cfgTypeGuide[5][this.gid].id);
                }
                if (int(this._cfgGuide[this.gid].isdotask) == 1)
                {
                    ModelProxy.change("taskdialog", "autotask", null);
                }
                else if (int(this._cfgGuide[this.gid].isdotask) == 2)
                {
                    ModelProxy.change("taskdialog", "autotask", null);
                    ModelProxy.change("plugin", "close", "shop");
                }
            }
            return;
        }// end function

        public function doGuide(param1:int) : void
        {
            var obj:Object;
            var _item1:Object;
            var str:String;
            var showType:int;
            var sArr:Array;
            var myrein:int;
            var rein:int;
            var lv:int;
            var guide:* = param1;
            if (this.isload == false)
            {
                return;
            }
            var obj1:* = UserData.getOnlineData("guide");
            if (this._cfgGuide[guide] == null)
            {
                return;
            }
            obj = this._cfgGuide[guide];
            if (!obj)
            {
                return;
            }
            if (this.gid == guide && this.visible)
            {
                return;
            }
            var repeat:* = int(obj.repeat);
            if (repeat == 1)
            {
            }
            else if (obj1 == null || int(obj1[guide]) == 1)
            {
                return;
            }
            var slv:* = obj.level;
            var mylevel:* = UserData.getUserData("level");
            if (slv.match("-"))
            {
                sArr = slv.split("-");
                myrein = UserData.getUserData("rein");
                rein = sArr[0];
                lv = sArr[1];
                if (myrein >= rein && mylevel > lv)
                {
                    return;
                }
            }
            if (mylevel < int(obj.needlevel))
            {
                return;
            }
            _item1 = ModelProxy.getValue("guideitem", "guideid" + guide) as Object;
            if (_item1 == null)
            {
                return;
            }
            if (obj.event == 6)
            {
                GuideViewPao.getInstance().doGuide(obj, _item1);
                this.hide();
                return;
            }
            this._dir = obj.dir;
            str = obj.desc;
            showType;
            this.visible = false;
            if (this.timeoutID1)
            {
                clearTimeout(this.timeoutID1);
                this.timeoutID1 = 0;
            }
            this.timeoutID1 = setTimeout(function () : void
            {
                if (_item)
                {
                    _item.filters = [];
                }
                _item = _item1;
                _noshow = obj.noshow;
                if (timeoutID)
                {
                    clearTimeout(timeoutID);
                    timeoutID = 0;
                }
                if (obj.iszidong == 1)
                {
                    timeoutID = setTimeout(clickHandler, int(obj.zidongtime) * 1000);
                }
                newguideObj = obj;
                addGuide(guide);
                gid = guide;
                show(str, getPoint(), showType);
                var _loc_1:* = _cfgGuide[gid].plugin;
                if (PluginManager.instance.getPlugin(_loc_1))
                {
                    PluginManager.instance.getPlugin(_loc_1).topDisplay(_loc_1);
                }
                return;
            }// end function
            , 100);
            return;
        }// end function

        private function clickHandler() : void
        {
            this._item.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
            return;
        }// end function

        private function doHs() : void
        {
            this.hide();
            PluginManager.instance.sendToBufferServer("zbhsy", CMDRecycle.RecycleAll, new Output());
            ModelProxy.change("data", "recycle", 1);
            return;
        }// end function

        private function getPoint() : Point
        {
            var _loc_1:String = null;
            if (this._item == null)
            {
                this.hide(false);
                return this.p3;
            }
            if (this._item.hasOwnProperty("disabled") && this._item.disabled)
            {
                this.hide(false);
                return this.p3;
            }
            if (this.gid > 0)
            {
                _loc_1 = this._cfgGuide[this.gid].plugin;
                if (_loc_1 != null && _loc_1 != "")
                {
                    if (PluginManager.instance.getPluginState(_loc_1) == "close")
                    {
                        if (int(this._cfgGuide[this.gid].isauto) == 1)
                        {
                            ModelProxy.change("taskdialog", "autotask", null);
                        }
                        else if (int(this._cfgGuide[this.gid].isauto) == 2)
                        {
                            PluginManager.instance.sendToBufferServer("zbhsy", CMDRecycle.RecycleAll, new Output());
                            ModelProxy.change("data", "recycle", 1);
                            ModelProxy.change("taskdialog", "autotask", null);
                            ModelProxy.change("plugin", "close", "bag");
                        }
                        else if (int(this._cfgGuide[this.gid].tobackid) > 0)
                        {
                            this.doGuide(int(this._cfgGuide[this.gid].tobackid));
                        }
                        this.hide(false);
                        return this.p3;
                    }
                }
            }
            if (!this._item.parent || this._item.visible == false || !this._item.parent.parent && this._dir == 6 || !this._item.stage)
            {
                this.hide(false);
                return this.p3;
            }
            if (this._dir == 1)
            {
                this.p.x = int(this._item.width / 2);
                this.p.y = int(this._item.height);
            }
            else if (this._dir == 4)
            {
                this.p.x = 0;
                this.p.y = int(this._item.height / 2);
            }
            else if (this._dir == 2)
            {
                this.p.x = int(this._item.width / 2);
                this.p.y = 0;
            }
            else if (this._dir == 3)
            {
                this.p.x = int(this._item.width);
                this.p.y = int(this._item.height / 2);
            }
            this.p1 = this._item.localToGlobal(this.p3);
            if (this.p1.x == 40 && this.p1.y == 20 || this.p1.x == 40 && this.p1.y == 17 || this.p1.x == 24 && this.p1.y == 50 || this.p1.x == 160 && this.p1.y == 62)
            {
                this.hide(false);
                return this.p3;
            }
            this.p2.x = this.p1.x + this.p.x;
            this.p2.y = this.p1.y + this.p.y;
            if (this._item.rotation != 0)
            {
                this.p2.x = this.p1.x + this.p.x - this._item.width;
                this.p2.y = this.p1.y + this.p.y - this._item.height;
            }
            return this.p2;
        }// end function

        public function doTaskGuide(param1:int, param2:int) : void
        {
            this.fTaskArr.push(param1);
            this.doGuide(param2);
            return;
        }// end function

        public function checkLvGuide(param1:int) : void
        {
            var _loc_5:Object = null;
            var _loc_6:Object = null;
            var _loc_7:int = 0;
            if (HandlerManager.instance.getHandler("skill"))
            {
                (HandlerManager.instance.getHandler("skill") as NewSkillHandler).checkSkill();
            }
            var _loc_2:* = UserData.getUserData();
            if (_loc_2.rein > 0)
            {
                return;
            }
            var _loc_3:int = 0;
            this.oldLevel = param1;
            ModelProxy.change("mainui", "showlvguide", param1);
            var _loc_4:* = UserData.getOnlineData("guide");
            if (UserData.getOnlineData("guide") == null)
            {
                return;
            }
            if (this._cfgGuide == null)
            {
                this._cfgGuide = ConfigDictionary.data.newguide;
            }
            for each (_loc_5 in this._cfgGuide)
            {
                
                if (_loc_5.type == 2)
                {
                    this._cfgLvGuide.push(_loc_5);
                }
            }
            this._cfgLvGuide.sortOn("typeparam");
            if (this._cfgLvGuide.length > 0)
            {
                for each (_loc_6 in this._cfgLvGuide)
                {
                    
                    _loc_7 = int(_loc_6.repeat);
                    if (_loc_7 == 1)
                    {
                    }
                    else if (_loc_4[_loc_6.id] == 1)
                    {
                        continue;
                    }
                    if (param1 >= _loc_6.typeparam)
                    {
                        _loc_3 = _loc_6.id;
                        this.doGuide(_loc_3);
                        break;
                    }
                }
            }
            return;
        }// end function

        public function doGuide1(param1:int, param2:String) : void
        {
            var _loc_3:* = param1;
            x = int((GlobalLayer.instance.root.stageWidth - 700) / 2);
            ModelProxy.change("plugin", "open", {target:param2, point:new Point(GlobalLayer.instance.root.stageWidth / 2, GlobalLayer.instance.root.stageHeight / 2 - 120), top:new Point(x, 100)});
            return;
        }// end function

        public function addGuide(param1:int) : void
        {
            var _loc_2:* = UserData.getOnlineData("guide");
            if (_loc_2 == null)
            {
                return;
            }
            if (int(_loc_2[param1]) == 0)
            {
                ModelProxy.change("plugin", "sendSysMsg", {name:"activity", param:param1, cmd:1001});
                _loc_2[param1] = 1;
            }
            return;
        }// end function

        public function initGuideTask() : void
        {
            return;
        }// end function

        private function changeOpen(param1:int) : void
        {
            var _loc_2:* = UserData.getOnlineData("guide");
            var _loc_3:Boolean = false;
            if (_loc_2 && int(_loc_2[param1]) == 1)
            {
                _loc_3 = true;
            }
            if (_loc_3)
            {
                ModelProxy.change("guidegn", "" + param1, true);
            }
            else
            {
                ModelProxy.change("guidegn", "" + param1, false);
            }
            return;
        }// end function

        private function changeOpen1(param1:int, param2:int) : void
        {
            var _loc_3:* = this._cfgGuide[param2].level;
            if (param1 >= _loc_3)
            {
                ModelProxy.change("guidegn", "" + param2, true);
            }
            else
            {
                ModelProxy.change("guidegn", "" + param2, false);
            }
            return;
        }// end function

        public function initGuide() : void
        {
            var _loc_1:* = UserData.getUserData("level");
            return;
        }// end function

        public function changeVisible(param1:int, param2:int) : void
        {
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            var _loc_5:Object = null;
            var _loc_6:Object = null;
            var _loc_7:int = 0;
            if (this._cfgGuide)
            {
                _loc_3 = 0;
                _loc_4 = ModelProxy.getValue("guideitem", "guideid" + param2) as Object;
                _loc_5 = ModelProxy.getValue("guideitem", "guideid_" + param2) as Object;
                _loc_6 = ModelProxy.getValue("guideitem", "guideid_1" + param2) as Object;
                _loc_7 = UserData.getUserData("rein");
                if (!_loc_4)
                {
                    return;
                }
                _loc_3 = this._cfgGuide[param2].level;
                if (ItemUilt.checkUserLevel(_loc_3) > 0)
                {
                    _loc_4.visible = false;
                    if (_loc_5)
                    {
                        _loc_5.visible = false;
                    }
                    if (_loc_6)
                    {
                        _loc_6.visible = false;
                    }
                }
                else
                {
                    _loc_4.visible = true;
                    if (_loc_5)
                    {
                        _loc_5.visible = true;
                    }
                    if (_loc_6)
                    {
                        _loc_6.visible = true;
                    }
                }
            }
            return;
        }// end function

        public function NeedLevel(param1:Object) : int
        {
            var _loc_2:int = 0;
            var _loc_3:* = ModelProxy.getValue("guideitem", "guideid" + param1) as Object;
            if (!_loc_3)
            {
                return 0;
            }
            return ItemUilt.checkUserLevel(this._cfgGuide[param1].level);
        }// end function

        public function changeVisible1(param1:int) : void
        {
            var _loc_2:* = ModelProxy.getValue("guideitem", "guideid" + param1) as Object;
            var _loc_3:* = ModelProxy.getValue("guideitem", "guideid_" + param1) as Object;
            var _loc_4:* = ModelProxy.getValue("guideitem", "guideid_1" + param1) as Object;
            var _loc_5:* = this._cfgGuide[param1].taskid;
            var _loc_6:Boolean = false;
            var _loc_7:* = UserData.getOnlineData("guide");
            if (UserData.getOnlineData("guide") != null && _loc_7[param1] == 1)
            {
                _loc_6 = true;
            }
            if (_loc_6 == false)
            {
                if (_loc_2)
                {
                    _loc_2.visible = false;
                }
                if (_loc_3)
                {
                    _loc_3.visible = false;
                }
                if (_loc_4)
                {
                    _loc_4.visible = false;
                }
            }
            else
            {
                if (_loc_2)
                {
                    _loc_2.visible = true;
                }
                if (_loc_3)
                {
                    _loc_3.visible = true;
                }
                if (_loc_4)
                {
                    _loc_4.visible = true;
                }
            }
            return;
        }// end function

        public function openPlugin(param1:int, param2:String, param3:int) : void
        {
            this.gid = param1;
            this.addGuide(this.gid);
            PluginManager.instance.openPlugin(param2, new Point(100, 100), param3, null);
            return;
        }// end function

        public function doNextGuide(param1:int) : void
        {
            var _loc_2:* = UserData.getOnlineData("guide");
            if (this._cfgGuide[param1] == null)
            {
                return;
            }
            var _loc_3:* = this._cfgGuide[param1];
            if (int(_loc_2[_loc_3.typeparam]) == 1 && int(_loc_2[param1]) == 0)
            {
                this.doGuide(param1);
            }
            return;
        }// end function

        public function checkIsDo(param1:int) : Boolean
        {
            var _loc_2:* = UserData.getOnlineData("guide");
            if (_loc_2 == null)
            {
                return false;
            }
            if (int(_loc_2[param1]) == 1)
            {
                return false;
            }
            return true;
        }// end function

        public static function getInstance() : GuideView
        {
            if (instance == null)
            {
                instance = new GuideView;
            }
            return instance;
        }// end function

    }
}
